index.test.js ➔ ???   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 16
rs 9.4285
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.test.js ➔ ... ➔ ??? 0 14 1
1
const { join } = require('path')
2
3
const loadRules = require('../../rules')
4
5
jest.mock('../../helper/rules')
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
6
const { getAllRuleName, load } = require('../../helper/rules')
7
8
describe('Rules helper', () => {
9
  it('input is a file path', () => {
10
    getAllRuleName.mockImplementation(() => ['a', 'b', 'c', 'd'])
11
    load.mockImplementation(name => name)
12
    const options = {
13
      order: ['c', 'x', 'a'],
14
      path: 'rules'
15
    }
16
    const expected = [
17
      join(__dirname, '../../rules', 'c'),
18
      join(__dirname, '../../rules', 'a')
19
    ]
20
    const ruleFunc = loadRules(options)
21
    expect(ruleFunc).toEqual(expected)
22
  })
23
})
24